#include "conf_loader.h"
#include "gvj_server.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <vector>

int main(int argc, char **argv) {
	ConfLoader cl;
	int load_res = cl.load();
	if (load_res != LOAD_OK) {
		// 记录启动，关闭日志
		exit(1);		
	}
	
	pid_t pid = fork();
	// 子进程，用于启动GvjServer
	if (pid == 0) {
		GvjServer *server = new GvjServer();
		server->main_process(cl.get_oj_vector());
		exit(0);
	}
	else if (pid > 0) {
		exit(0);
	}
	else {
		// fork ERROR, 记录启动，关闭日志
		exit(1);
	}
}
